<html>
<head>
        <script type="text/javascript" src="jquery-1.7.2.js"></script>
		<script type='text/javascript'>
        	$(document).ready(function(){
				
				$("#assignments").change(function(){
					var id = $("select#assignments option:selected").attr('value');
					$.post("select_groups.php", {id:id}, function(data){
						$('#groups').replaceWith(data);
					});

				});
				
				$("#input#btnSubmit").click(function() {
					$("bdyStudents td").each(function(i,o){
						var value = ( $(":first-child", this).is(":input") ) 
						? $(":first-child", this).val() 
						: ( $(this).text() != "" ) 
						? $(this).text() 
						: $(this).html() ;
						alert(value);
					});
				});
				
								
				$("#groups").change(function(){
				var id = $("select#groups option:selected").attr('value');
					$.post("select_students.php", {id:id}, function(data){
						$('#studenttable > tbody').replaceWith(data);
					});

				});
	        });
			
        </script>
</head>

<body>
<form name='Lecturer Marking page'>
<table>
<tr>
<?php include "lectmarkingpage.class.php"; ?>
<td>Assignment: </td>
<select id="assignments">
<?php echo $opt->GetAssignments(); ?>
</select>
<td></td>
</tr>
<tr>
<td>Group: </td>
<td><select id="groups">
</select>
</td>
</tr>
</table>
<table id="studenttable">
		<thead>
		<th>Firstname</th><th>StudentKey</th><th>Percentage</th><th>Remarks</th>
		</thead>
		</tbody>
		</table>
		<input type="button" value="confirm" id="btnSubmit"/>
		<tbody>
</table>
</html>